﻿using Microsoft.Extensions.Hosting;
using ShanNiang.AutoUpdate.Service.Responses;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace ShanNiang.AutoUpdate.Service.Interfaces
{
    /// <summary>
    /// 检测版本接口
    /// </summary>
    public interface ICheckVersionService: IHostedService
    {
        /// <summary>
        /// 查询远程发布的版本号
        /// </summary>
        /// <returns></returns>
        Task<PublishedClientResponse?> GetRemoteVersionAsync();
        /// <summary>
        /// 获取本地版本号
        /// </summary>
        /// <returns></returns>
        Version GetLocalVersion(Assembly? assembly);
        /// <summary>
        /// 检测是否需要升级
        /// </summary>
        /// <returns></returns>
        Task<bool> NeedToUpdateAsync(Assembly? assembly);
        /// <summary>
        /// 设置本地版本号
        /// </summary>
        /// <param name="version"></param>
        void SetLocalVersion(string version);
    }
}
